<template>
	<view class="" style="width: 100vw;height: 100vh;">
		<view class="content" :style="{'background':kbackgroundColor}" style="min-height: 100vh">
			<hx-navbar title="邀请记录" :back="true" :fixed="false" :color="knavTitleColor" barPlaceholder="hidden"
				transparent="auto"></hx-navbar>
			<!-- 紫色 -->
			<view class="container"  v-if="yanshengbgimage==='purple'">
				<view class="invite_item" :style="{background:kcellBgColor}" v-for="item,id in list" :key="id">
					<image src="@/logo.png" class="invite_head" mode="aspectFill"></image>
					<view class="invite_info">
						{{item.nickname}}
						<view class="small_text" style="color: #c5c5c5;">
							电话:{{item.phone}}
						</view>
						<view class="small_text" style="color: #c5c5c5;">
							邀请时间: {{item.createTime|ftime}}
						</view>
					</view>
					<view class="right_box">
						<!-- <view class="see_detail" @tap="see_detail(item.id)">
							<text>
								查看下级
							</text>
						</view> -->
						<view class="small_text2">
							<text class="color-D78E65" v-if="!item.isCertified">邀请人未实名未开户</text>
							<text class="color-D78E65" v-if="item.isCertified && !item.isWallet">邀请人已实名未开户</text>
							<text style="color: #59B236;" v-if="item.isCertified && item.isWallet">邀请成功</text>
						</view>
					</view>
				</view>
				<view style="text-align: center;" v-if="list.length == 0">
					<image src="@/static/without.png" style="width:550rpx;margin: 10rpx auto " alt="" mode="widthFix">
					</image>
				</view>
			</view>
			<!-- 绿色 -->
			<view class="container"  v-if="yanshengbgimage!=='purple'">
				<view class="invite_item" :style="{background:kcellBgColor}" v-for="item,id in list" :key="id">
					<image src="@/logo.png" class="invite_head white_size" mode="aspectFill"></image>
					<view class="invite_info ">
					<text class="white_size">	{{item.nickname}}</text>
					<view class="small_text" style="color: #c5c5c5;">
						电话:{{item.phone}} 	
					</view>
					<view class="small_text" style="color: #c5c5c5;">
						邀请时间: {{item.createTime|ftime}}
					</view>
					</view>
					<view class="right_box white_size">
						<view class="small_text2" style="font-size: 32rpx;">
					 	<text class="white_size" v-if="!item.isCertified">未实名未开户</text>
					 	<text class="white_size" v-if="item.isCertified && !item.isWallet">已实名未开户</text>
					 	<text class="white_size" style="color:#F1CF99;font-size: 28rpx;" v-if="item.isCertified && item.isWallet">
							<image src="@/static/user/menu_icon/shiming.png" style="width: 25rpx;" mode="widthFix"></image>
							<text style="margin-left: 5rpx;">邀请成功</text>
						</text>
						</view>
					</view>
				</view>
				<view style="text-align: center;" v-if="list.length == 0">
					<image src="@/static/without.png" style="width:550rpx;margin: 10rpx auto " alt="" mode="widthFix">
					</image>
				</view>
			</view>
			<view class="scrollClsss" v-if="ifscroll" @click="scrollClick(0)">
				<image src="@/static/user/huojian.png" style="width: 110rpx;" mode="widthFix"></image>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				yanshengbgimage: true,
				ifscroll: false,
				scrollTop: 0,
				page: 1,
				limit: 10,
				hasNextPage: true,
				list: [],
				is_superior: true,
				inviteKey: ''
			}
		},
		filters: {
			ftime(val) {
				return uni.$u.timeFormat(parseInt(val), 'yyyy-mm-dd hh:MM')
			}
		},
		//滑动显示火箭返回顶部
	/* 	onPageScroll(e) {
			if (this.scrollTop >= 200) {
				this.ifscroll = true
			} else {
				this.ifscroll = false
			}
			this.scrollTop = e.scrollTop;
		},
		onLoad() {
			this.yanshengbgimage = this.$store.state.ktheme
			this.get_data_list()
		}, */
		onShow() {
			// this.$api.myInvite(res => {
			// 	this.code = res.data.code;
			// 	this.money = res.data.money;
			// 	this.number = res.data.number;
			// 	this.is_superior = res.data.is_superior;
			// });
		},
		onPullDownRefresh() {
			
			this.page = 1;
			this.list = [];
			this.hasNextPage = true;
			let data = {
				pageNo: this.page,
			}
			this.$api.getMyInviteList(data, res => {
				if (res.status) {
					this.list = this.list.concat(res.data.list);
					this.hasNextPage = res.data.list.length >= this.limit;
				}
				uni.stopPullDownRefresh()
			})
		},
		onReachBottom() {
			if (this.hasNextPage) {
				let new_page = this.page + 1;
				let data = {
					pageNo: new_page,
					// limit: this.limit
				}
				this.$api.getMyInviteList(data, res => {
					if (res.status) {
						this.list = this.list.concat(res.data.list);
						this.hasNextPage = res.data.list.length >= this.limit;
						this.page = new_page
					}
				})
			}
		},
		methods: {
			scrollClick(val) {
				uni.pageScrollTo({
					scrollTop: val,
					duration: 200,
				})
				this.scrollTop = val
			},
			setMyInvite() {
				let data = {
					code: this.inviteKey
				}
				this.$api.setMyInvite(data, res => {
					if (res.status) {
						this.$common.successToShow('邀请码填写成功');
						this.is_superior = true;
					} else {
						this.$common.errorToShow(res.msg);
					}
				});
			},
			see_detail: function(id) {
				uni.navigateTo({
					url: 'list?id=' + id
				})
			},

			get_data_list: function() {
				let data = {
					pageNo: this.page,
					// limit: this.limit
				}
				this.$api.getMyInviteList(data, res => {
					if (res.status) {
						this.list = res.data.list;
						this.hasNextPage = res.data.list.length >= this.limit
					}
				})
			}
		}
	}
</script>


<style lang="scss">
	.white_size{
		color: white;
		font-size: 30rpx;
	}
	.submit {
		width: 320rpx;
		height: 45rpx;
		background-color: #d5b369;
		color: #fff;
		font-size: 26rpx;
	}

	.inputerr {
		width: 100%;
		border-bottom: 1rpx solid #9B9CA0;
		font-size: 28rpx;
		color: #9B9CA0;
		height: 50rpx;
		margin: 30rpx 0;

		text-align: center;
	}

	.inviter_title {
		width: 100%;
		text-align: center;
		font-size: 32rpx;
		color: #d5b369;

	}

	.my_inviter {
		width: 100%;
		background-color: #fff;
		padding: 30rpx;
		display: flex;
		align-items: center;
		flex-direction: column;
		border-radius: 30rpx;
		margin-bottom: 30rpx;
	}

	.top40 {
		margin-top: 40rpx;
	}

	.see_detail text {
		position: relative;
	}

	.see_detail {
		width: 140rpx;
		height: 40rpx;
		border-radius: 24rpx;
		border: 1rpx solid #FE005A;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 24rpx;
		color: #FE005A;
		position: relative;
		margin-bottom: 42rpx;
	}

	.right_box {
		display: flex;
		flex-direction: column;
		align-items: flex-end;
	}

	.small_text {
		font-size: 24rpx;
	
		font-weight: normal;
		line-height: 40rpx;
	}


	.invite_info {
		flex: 1;
		font-size: 32rpx;
	
		font-weight: bold;
	}

	.invite_head {
		height: 80rpx;
		width: 80rpx;
		border-radius: 50%;
		margin-right: 14rpx;
		margin-top: 24rpx;
	}

	.invite_item {
		width: 100%;
		// height: 235rpx;
		border-radius: 20rpx;
		display: flex;
		padding: 30rpx 20rpx;
		margin-bottom: 20rpx;
	}
	// 
.lv_border{
	clip-path: inset(0 round 13rpx);
	background: linear-gradient(180deg, #B8CD71 0%, rgba(184,205,113,0) 100%);
	 border-radius: 15rpx;
	border: 3px solid;
	border-image: linear-gradient(0deg, #55CC7C, #F5F97F) 10 10;
}
	.container {
		width: 100%;
		padding: 20rpx 40rpx;

		&>view:last-child {
			margin-bottom: 0;
		}
	}

	.scrollClsss {
		position: fixed;
		bottom: 150rpx;
		right: -16rpx;
		z-index: 999;
		width: 120rpx;
		// height: 100rpx;

	}
</style>